[Chapter 3] 3.8 Databases in Rules
Author: Bryan Costales & Eric Allman
Date: 1999-02-04T00:04:32Z

#

| Chapter 3 Databases |

## 3.8 Databases in Rules

Databases are accessed inside the RHS of rules with the $( and $) operators:

>     $( name key $)

This looks up key in the database named name and replaces the entire expression (operators and all) with the value found in the database. If no value is found, the key replaces the expression, unless a $: gives a default:

>     $( name key $: default $)

in which instance the default replaces the entire expression.

Optional replacement text can be appear between the name and the $: (if one) or the $). Each is of the form "$@text":

>     $( name key $@text1 $@text2 $)
>     $( name key $@text1 $@text2 $: default $)

The first (the $@`text1`) will replace any literal %1 expressions in the value returned by the database. The second (the $@`text2`) will replace %2, and so on. In this scheme, %0 always references the key. But note that not all map classes do this replacement.

3.7 Classes |  | 3.9 The User Database